import request from '@/utils/request'

/**
 * 获取角色列表
 * @returns {Promise<void>}
 */
export async function getRoleList (params) {
  return request('/admin/roles', { params })
}

/**
 * 添加角色
 * @param data
 * @returns {Promise<*>}
 */
export const addRole = async (data) => {
  return request.post('/admin/roles', { data })
}

/**
 * 角色详情
 * @param id
 * @returns {Promise<*>}
 */
export const getDetailRole = async (id) => {
  return request(`/admin/roles/${id}`)
}

/**
 * 修改角色
 * @param data
 * @returns {Promise<*>}
 */
export const updateRole = async (data) => {
  return request.put(`/admin/roles/${data.id}`, { data })
}

/**
 * 删除角色
 * @param id
 * @returns {Promise<*>}
 */
export const deleteRole = async (id) => {
  return request.delete(`/admin/roles/${id}`)
}
